package com.collect.cameroon.zhiAdater.zhiLevelDetail;

import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.collect.cameroon.R;
import com.collect.cameroon.zhiBean.zhiReceive.ZHIRCustomerPerformanceEntity;

public class ZHILevelDetailCustomerMember5Column extends BaseQuickAdapter<ZHIRCustomerPerformanceEntity, BaseViewHolder> {

    private ZHILevelDetailCustomerMember5ColumnClickListener mZHILevelDetailCustomerMember5ColumnClickListener;

    public ZHILevelDetailCustomerMember5Column() {
        super(R.layout.item_level_detail_column_5, null);
    }

    @Override
    protected void convert(BaseViewHolder helper, ZHIRCustomerPerformanceEntity item) {
        helper.setText(R.id.tv_col_0, item.getAssignDateFormatDisplay());
        helper.setText(R.id.tv_col_1, item.getAssignNumFormatInt() + "");
        helper.setText(R.id.tv_col_2, item.getTaskNumFormatInt()+"");
        helper.setText(R.id.tv_col_3, item.getRepayNumFormatInt() + "");
        helper.setText(R.id.tv_col_4, item.getActualBonusFormat());

        TextView tv_col_0 = helper.getView(R.id.tv_col_0);
        TextView tv_col_1 = helper.getView(R.id.tv_col_1);
        TextView tv_col_2 = helper.getView(R.id.tv_col_2);
        TextView tv_col_3 = helper.getView(R.id.tv_col_3);
        TextView tv_col_4 = helper.getView(R.id.tv_col_4);

        tv_col_0.setOnClickListener(v -> {
            if (mZHILevelDetailCustomerMember5ColumnClickListener != null) {
                mZHILevelDetailCustomerMember5ColumnClickListener.onItemClick(item);
            }
        });

        tv_col_1.setOnClickListener(v -> {
            if (mZHILevelDetailCustomerMember5ColumnClickListener != null) {
                mZHILevelDetailCustomerMember5ColumnClickListener.onItemClick(item);
            }
        });

        tv_col_2.setOnClickListener(v -> {
            if (mZHILevelDetailCustomerMember5ColumnClickListener != null) {
                mZHILevelDetailCustomerMember5ColumnClickListener.onItemClick(item);
            }
        });

        tv_col_3.setOnClickListener(v -> {
            if (mZHILevelDetailCustomerMember5ColumnClickListener != null) {
                mZHILevelDetailCustomerMember5ColumnClickListener.onItemClick(item);
            }
        });

        tv_col_4.setOnClickListener(v -> {
            if (mZHILevelDetailCustomerMember5ColumnClickListener != null) {
                mZHILevelDetailCustomerMember5ColumnClickListener.onItemClick(item);
            }
        });
    }

    public void setColumnItemClick(ZHILevelDetailCustomerMember5ColumnClickListener listener) {
        mZHILevelDetailCustomerMember5ColumnClickListener = listener;
    }

    public interface ZHILevelDetailCustomerMember5ColumnClickListener {
        void onItemClick(ZHIRCustomerPerformanceEntity item);
    }
}
